import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 查询调拨入库主单
export const queryAllocationIn = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryAllocationIn`, { params });
// 保存调拨入库
export const saveAllocationIn = params => axios.post(`${SERVER.DMSCLOUD_PART}/allocation/saveAllocationIn`, params);
//查询调拨入库明细（未删除）
export const queryAllocationInItems = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryAllocationInItems`, { params });
//调拨入库单作废
export const deleteAllocationIn = params => axios.post(`${SERVER.DMSCLOUD_PART}/allocation/deleteAllocationIn`, params);
//调拨入库单提交
export const submitAllocationIn = params => axios.post(`${SERVER.DMSCLOUD_PART}/allocation/submitAllocationIn`, params);
//查询调拨入库明细（所有）
export const queryAllocationInAllItems = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryAllocationInAllItems`, { params });
// 查询调拨出库主单
export const queryAllocationOut = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryAllocationOut`, { params });
//查询调拨出库明细（未删除）
export const queryAllocationOutItems = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryAllocationOutItems`, { params });
//查询库存信息及各种价格
export const queryStockInfo = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryStockInfo`, { params });
//审核调拨出库单
export const examinedAllocationOut = params => axios.post(`${SERVER.DMSCLOUD_PART}/allocation/examinedAllocationOut`, params);
//获取审核记录
export const getExaminedLogs = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/getExaminedLogs`, { params });
//出库调拨出库单
export const outStorageAllocationOut = params => axios.post(`${SERVER.DMSCLOUD_PART}/allocation/outStorageAllocationOut`, params);
//入库调拨入库单
export const inStorageAllocationIn = params => axios.post(`${SERVER.DMSCLOUD_PART}/allocation/inStorageAllocationIn`, params);
//提交作废申请
export const submitDeleteAllocationIn = params => axios.post(`${SERVER.DMSCLOUD_PART}/allocation/subDeleteAllcation`, params);
//取消作废申请
export const cancelSubDeleteAllcation = params => axios.post(`${SERVER.DMSCLOUD_PART}/allocation/cancelSubDeleteAllcation`, params);
//获取所有经销商
export const dealerInfoByAllInfo = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/dealerInfo/byAllTranslate`, { params });
// 查询事业部
export const getOrgList = params => axios.get(`${SERVER.SYSMANAGE}/org/getBusinessOrg`, { params });
// 查询未关联的调拨出库单
export const queryAllocationOutWithoutIn = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryAllocationOutWithoutIn`, { params });
// 查询调拨单
export const queryAllocationOrder = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryAllocationOrder`, { params });
//搜索经销商
export const byAllInfo = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/dealerInfo/byAllInfo`, { params });
// 入库打印接口
export const printData = (itemId, params) => {
  return axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryInPrintData/${itemId}/${params}`);
};
// 出库打印接口
export const printDataOut = (itemId, params) => {
  return axios.get(`${SERVER.DMSCLOUD_PART}/allocation/queryOutPrintData/${itemId}/${params}`);
};
// 导出
export const exportData = params => axios.get(`${SERVER.DMSCLOUD_PART}/allocation/export`, { params, responseType: 'blob' });
